package com.witte.serviceImp;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.witte.dao.UserRootMapper;
import com.witte.entity.UserRoot;
import com.witte.service.UserRootService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
 public class UserRootServiceImp implements UserRootService {
        @Autowired
        private UserRootMapper userRootMapper;

        @Override
        public UserRoot getUserById(int id) {

            return userRootMapper.selectByPrimaryKey(id);
        }

    @Override
    public UserRoot getName() {
        return userRootMapper.selectUserName();
    }

    @Override
    public List<UserRoot> selectAll() {
        List<UserRoot> list = userRootMapper.selectAll();
        return list;
    }

    @Override
    public List<UserRoot> selectByRule(UserRoot userRoot) {
            List<UserRoot> list =userRootMapper.selectByRule(userRoot);
        return list;
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
            int num = userRootMapper.deleteByPrimaryKey(id);
        return num;
    }

    @Override
    public int updateByPrimaryKey(UserRoot userRoot) {
            int num =userRootMapper.updateByPrimaryKey(userRoot);
        return num;
    }

    @Override
    public int insert(UserRoot userRoot) {
            int num =userRootMapper.insertSelective(userRoot);
        return num;
    }

    @Override
    public List<UserRoot> getRecordList(Integer beginPage, Integer pageSize) {
            int begin =(beginPage-1)*pageSize;
            return userRootMapper.getRecordList(begin,pageSize);
    }

    @Override
    public int getRecordCount() {
        return userRootMapper.getRecordCount();
    }

    }

